package com.party.controller.api;


import com.party.common.base.ApiResult;
import com.party.common.entity.MyPage;
import com.party.entity.PbBanner;
import com.party.entity.PbDevice;
import com.party.entity.PbUser;
import com.party.entity.dto.QueryBannerDto;
import com.party.entity.dto.QueryDeviceDto;
import com.party.service.PbBannerService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * <p>
 * banner
 前端控制器
 * </p>
 *
 * @author ccl
 * @since 2024-10-25
 */
@RestController
@RequestMapping("api/pb-banner")
@Api(tags = "banner相关api接口", value = "banner相关api接口")
public class PbBannerController {

    @Resource
    private PbBannerService pbBannerService;

    @PostMapping("add")
    @ApiOperation("保存")
    public ApiResult add(@RequestBody PbBanner pbBanner){
        return ApiResult.ok(pbBannerService.add(pbBanner));

    }

    @PostMapping("update")
    @ApiOperation("编辑")
    public ApiResult update(@RequestBody PbBanner pbBanner){
        return ApiResult.ok(pbBannerService.edit(pbBanner));
    }

    @GetMapping("delete")
    @ApiOperation("删除")
    public ApiResult delete(Long id){
        return ApiResult.ok(pbBannerService.delete(id));
    }

    @PostMapping("queryPage")
    @ApiOperation("分页查询")
    public ApiResult<MyPage<PbBanner>> queryPage(@RequestBody QueryBannerDto dto){
        MyPage<PbBanner> ccpSystemUserMyPage = pbBannerService.queryPage(dto);
        return ApiResult.ok(ccpSystemUserMyPage);
    }

    @GetMapping("detail")
    @ApiOperation(value = "详情",response = PbUser.class)
    public ApiResult detail(Long id){
        return ApiResult.ok(pbBannerService.detail(id));
    }

}

